<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Model_photos extends CI_Model {
	 function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    } 
	
	function getMemberProfilePicture($member_id){
		$this->db->select('name');
		$this->db->where('member_id',$member_id);
		$this->db->where('profile_picture',1);
		$q = $this->db->get('m_photos');
		$data = array_shift($q->result_array());
		return $data['name'];
		}
	function update_profile($photo_id){
		$insArr  = array( "profile_picture" =>0);
		$this->db->update('m_photos', $insArr, array('member_id' => $this->session->userdata("USER_ID")));
		$newinsArr  = array( "profile_picture" =>1);
		$this->db->update('m_photos', $newinsArr, array('id' => $photo_id));
		}	
	
	
}